import http from './interface';
const qs = require('qs')
export const test = (data) => {
	/* http.config.baseUrl = "http://localhost:8080/api/"
	//设置请求前拦截器
	http.interceptor.request = (config) => {
		config.header = {
			"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
		}
	} */
	//设置请求结束后拦截器
	http.interceptor.response = (response) => {
		console.log('个性化response....')
		//判断返回状态 执行相应操作
		return response;
	}
	return http.request({
		baseUrl: 'https://unidemo.dcloud.net.cn/',
		url: 'ajax/echo/text?name=uni-app',
		dataType: 'text',
		data,
	})
}

//微信小程序登录
export const login = (data) => {
	return http.request({
		url: '/api/fei_hong/login',
		method: 'POST',
		data,
	})
}

export const sms = (data) => {
	return http.request({
		url: '/api/fei_hong/sms',
		method: 'POST',
		data,
	})
}


export const getBanner = (data) => {
	return http.request({
		url: '/api/fei_hong/getBanner',
		method: 'GET',
		data,
	})
}

export const getUserList = (data) => {
	return http.request({
		url: '/api/fei_hong/getUserList',
		method: 'GET',
		data,
	})
}

export const agreement = (data) => {
	return http.request({
		url: '/api/fei_hong/agreement',
		method: 'GET',
		data,
	})
}

export const logout = (data) => {
	return http.request({
		url: '/api/fei_hong/logout',
		method: 'GET',
		data,
	})
}

export const register = (data) => {
	return http.request({
		url: '/api/fei_hong/register',
		method: 'POST',
		data,
	})
}

export const goodsList = (data) => {
	return http.request({
		url: '/api/fei_hong/goodsList',
		method: 'GET',
		data,
	})
}

export const bookingList = (data) => {
	return http.request({
		url: '/api/fei_hong/bookingList',
		method: 'POST',
		data,
	})
}
export const booking = (data) => {
	return http.request({
		url: '/api/fei_hong/booking',
		method: 'POST',
		data,
	})
}

export const management = (data) => {
	return http.request({
		url: '/api/fei_hong/management',
		method: 'POST',
		data,
	})
}

export const managementList = (data) => {
	return http.request({
		url: '/api/fei_hong/managementList',
		method: 'GET',
		data,
	})
}

export const address = (data) => {
	return http.request({
		url: '/api/fei_hong/address',
		method: 'POST',
		data,
	})
}

export const myOrder = (data) => {
	return http.request({
		url: '/api/fei_hong/myOrder',
		method: 'GET',
		data,
	})
}

export const orderNum = (data) => {
	return http.request({
		url: '/api/fei_hong/orderNum',
		method: 'GET',
		data,
	})
}

export const userInfos = (data) => {
	return http.request({
		url: '/api/fei_hong/userInfos',
		method: 'POST',
		data,
	})
}


export const uploadHead = (data, header) => {
	return http.request({
		url: '/api/fei_hong/uploadHead',
		method: 'POST',
		data,
		header: {
			'content-type': header,
		},
	})
}
// 订单确认提交
export const smOrder = (data, header) => {
	return http.request({
		url: '/api/fei_hong/smOrder',
		method: 'POST',
		data,
	})
}

export const payMessage = (data, header) => {
	return http.request({
		url: '/api/fei_hong/payMessage',
		method: 'GET',
		data,
	})
}


export const orderDetail = (data, header) => {
	return http.request({
		url: '/api/fei_hong/orderDetail',
		method: 'GET',
		data,
	})
}


export const bottle = (data, header) => {
	return http.request({
		url: '/api/fei_hong/bottle',
		method: 'GET',
		data,
	})
}


export const payment = (data, header) => {
	return http.request({
		url: '/api/fei_hong/payment',
		method: 'POST',
		data,
	})
}


export const delCart = (data, header) => {
	return http.request({
		url: '/api/fei_hong/delCart',
		method: 'POST',
		data,
	})
}


export const showMsg = (data, header) => {
	return http.request({
		url: '/api/fei_hong/showMsg',
		method: 'POST',
		data,
	})
}
export const clearCart = (data, header) => {
	return http.request({
		url: '/api/fei_hong/clearCart',
		method: 'POST',
		data,
	})
}

export const showConfig = (data, header) => {
	return http.request({
		url: '/api/fei_hong/showConfig',
		method: 'GET',
		data,
	})
}
// showConfig?type=pay&name=bottle_deposit

export const payMoney = (data, header) => {
	return http.request({
		url: '/api/fei_hong/payMoney',
		method: 'POST',
		data,
	})
}

export const myBookSite = (data, header) => {
	return http.request({
		url: '/api/fei_hong/myBookSite',
		method: 'POST',
		data,
	})
}

//授权状态
export const isAgreement = (data, header) => {
	return http.request({
		url: '/api/fei_hong/isAgreement',
		method: 'GET',
		data,
	})
}
//改变授权
export const smAgreement = (data, header) => {
	return http.request({
		url: '/api/fei_hong/smAgreement',
		method: 'POST',
		data,
	})
}




export const jscode2session = (data, header) => {
	return http.request({
		baseUrl:'https://api.weixin.qq.com',
		url: '/sns/jscode2session',
		method: 'GET',
		data,
	})
}

export const getWeChatToken = (data, header) => {
	return http.request({
		url: '/api/fei_hong/getWeChatToken',
		method: 'GET',
		data,
	})
}

export const getWeChatlphone = (data, header) => {
	return http.request({
		url: '/api/fei_hong/getWeChatiphone',
		method: 'GET',
		data,
	})
}

export const bookingNew = (data, header) => {
	return http.request({
		url: '/api/fei_hong/bookingNew',
		method: 'POST',
		data,
	})
}

// 默认全部导出  import api from '@/common/vmeitime-http/'
export default {
	bookingNew,
	getWeChatlphone,
	getWeChatToken,
	jscode2session,
	isAgreement,
	smAgreement,
	myBookSite,
	payMoney,
	showConfig,
	clearCart,
	showMsg,
	delCart,
	payment,
	bottle,
	orderDetail,
	payMessage,
	smOrder,
	uploadHead,
	userInfos,
	bookingList,
	booking,
	address,
	login,
	sms,
	getBanner,
	getUserList,
	agreement,
	logout,
	register,
	goodsList,
	management,
	managementList,
	myOrder,
	orderNum,
}